// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsICacheSession.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    ///-*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
    ///
    /// This Source Code Form is subject to the terms of the Mozilla Public
    /// License, v. 2.0. If a copy of the MPL was not distributed with this
    /// file, You can obtain one at http://mozilla.org/MPL/2.0/. </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("1dd7708c-de48-4ffe-b5aa-cd218c762887")]
	public interface nsICacheSession
	{
		
		/// <summary>
        /// Expired entries will be doomed or evicted if this attribute is set to
        /// true.  If false, expired entries will be returned (useful for offline-
        /// mode and clients, such as HTTP, that can update the valid lifetime of
        /// cached content).  This attribute defaults to true.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetDoomEntriesIfExpiredAttribute();
		
		/// <summary>
        /// Expired entries will be doomed or evicted if this attribute is set to
        /// true.  If false, expired entries will be returned (useful for offline-
        /// mode and clients, such as HTTP, that can update the valid lifetime of
        /// cached content).  This attribute defaults to true.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetDoomEntriesIfExpiredAttribute([MarshalAs(UnmanagedType.U1)] bool aDoomEntriesIfExpired);
		
		/// <summary>
        /// When set, entries created with this session will be placed to a cache
        /// based at this directory.  Use when storing entries to a different
        /// profile than the active profile of the the current running application
        /// process.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIFile GetProfileDirectoryAttribute();
		
		/// <summary>
        /// When set, entries created with this session will be placed to a cache
        /// based at this directory.  Use when storing entries to a different
        /// profile than the active profile of the the current running application
        /// process.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetProfileDirectoryAttribute([MarshalAs(UnmanagedType.Interface)] nsIFile aProfileDirectory);
		
		/// <summary>
        /// Synchronous cache access. This method fails if it is called on the main
        /// thread. Use asyncOpenCacheEntry() instead. This returns a unique
        /// descriptor each time it is called, even if the same key is specified.
        /// When called by multiple threads for write access, only one writable
        /// descriptor will be granted.  If 'blockingMode' is set to false, it will
        /// return NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than block when another
        /// descriptor has been given WRITE access but hasn't validated the entry yet.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsICacheEntryDescriptor OpenCacheEntry([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase key, System.IntPtr accessRequested, [MarshalAs(UnmanagedType.U1)] bool blockingMode);
		
		/// <summary>
        /// Asynchronous cache access. Does not block the calling thread. Instead,
        /// the listener will be notified when the descriptor is available. If
        /// 'noWait' is set to true, the listener will be notified immediately with
        /// status NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than queuing the request
        /// when another descriptor has been given WRITE access but hasn't validated
        /// the entry yet.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void AsyncOpenCacheEntry([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase key, System.IntPtr accessRequested, [MarshalAs(UnmanagedType.Interface)] nsICacheListener listener, [MarshalAs(UnmanagedType.U1)] bool noWait);
		
		/// <summary>
        /// Evict all entries for this session's clientID according to its storagePolicy.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void EvictEntries();
		
		/// <summary>
        /// Return whether any of the cache devices implied by the session storage policy
        /// are currently enabled for instantiation if they don't already exist.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool IsStorageEnabled();
		
		/// <summary>
        /// Asynchronously doom an entry specified by the key. Listener will be
        /// notified about the status of the operation. Null may be passed if caller
        /// doesn't care about the result.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void DoomEntry([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase key, [MarshalAs(UnmanagedType.Interface)] nsICacheListener listener);
		
		/// <summary>
        /// Private entries will be doomed when the last private browsing session
        /// finishes.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetIsPrivateAttribute();
		
		/// <summary>
        /// Private entries will be doomed when the last private browsing session
        /// finishes.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetIsPrivateAttribute([MarshalAs(UnmanagedType.U1)] bool aIsPrivate);
	}
}
